<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
<title></title>
<style>

</style>
<script src="../../JS/vue.js"></script>
</head>
<body>
<div id="example">
	<input v-model="num">
	<input type="button" v-on:click="judge()" value="查看结果">
	<p>{{result}}</p>
</div>
<script type="text/javascript">
var vm = new Vue({
	el:'#example',
	data:{
		num : '',
		result : ''
	},
	methods : {
		judge : function(){
			if(this.num == ''){
				this.result = '请输入一个数字';
			}else if(this.num % 2 == 1){
				this.result = this.num + '是奇数';
			}else{
				this.result = this.num + '是偶数';
			}
		}
	}
})
</script>


</body>

</html>



